Skip to content

feat: Centralised configuration utility#17

Draft
nicoloesch wants to merge 9 commits into
mainfrom
15-oa-config
Draft

feat: Centralised configuration utility#17
nicoloesch wants to merge 9 commits into
mainfrom
15-oa-config

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

Summary

Adapts omop-graph to the oa-configurator configuration layer, replacing the previous environment-variable-based setup with a typed TOML-backed config and a first-class omop-config configure omop_graph subcommand.

Fixes: #15

Notes

Depends on the oa-configurator PR to pass.

Requires change in pyproject.toml to include the published PyPI package once changes have been approved:

dependencies = [
  "omop-alchemy>=0.6.3",
  "sqlalchemy>=2.0.45",
  "typing-extensions>=4.15.0",
  "typer",
  "oaklib",
  #"oa-configurator>=0.2.0",  # <-- uncomment and pin once on PyPI
]

Changes

  • OmopGraphConfig subclasses PackageConfigBase, exposing all package settings as typed Pydantic fields backed by [tools.omop_graph] in ~/.config/omop/config.toml
  • Entry point registered under omop.config so omop-config configure omop_graph prompts for package extras interactively or via named flags (--max-depth, --max-paths); omop-graph owns no database resource directly — it relies on the CDM resource configured by omop-alchemy
  • OmopGraphConfig.get_config() (inherited classmethod) replaces the old standalone get_config() function; all internal call sites updated
  • Resolver.from_active_config() replaces the old standalone get_resolver() function; all engine-creation helpers updated (db/session.py, oaklib_interface/omop_factory.py)
  • OmopGraphConfig.configure_logging(verbosity=…) (inherited classmethod) replaces the old standalone configure_logging() wrapper; extra_logging_namespaces = ("omop_alchemy", "omop_emb") declares transitive dependencies whose logs are also configured (omop_emb is optional but harmless to include)
  • docker-compose.yaml updated from --resource-set/--set flags to named flags matching the new CLI

Testing

# Interactive configure (package extras only — CDM resource comes from omop-alchemy)
omop-config configure omop_graph

# Non-interactive (Docker / CI)
omop-config configure omop_graph --max-depth 6 --max-paths 20

# Verify config loaded correctly
python -c "from omop_graph.config import OmopGraphConfig; print(OmopGraphConfig.get_config())"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include oa-configurator for centralised configuration

1 participant